<template>
  <swiper ref="swiper" v-if="banners.length">
    <swiper-item v-for="(item, index) in banners" :key="index">
      <a :href="item.link">
        <img :src="item.image" alt="">
      </a>
    </swiper-item>
  </swiper>
</template>

<script>
  import {Swiper, SwiperItem} from '@/components/common/swiper'

  // const defaultBanner = [
  //         {link:'http://baidu.com', image:'https://img11.360buyimg.com/n7/jfs/t14971/217/2649724097/346210/af77cc0/5ab20350N25444a44.jpg'},
  //         {link:'http://baidu.com', image:'https://img12.360buyimg.com/n7/jfs/t1/132023/9/9411/256405/5f58c3d0E993ae654/7a54da7a13d685d3.png'},
  //         {link:'http://baidu.com', image:'https://img11.360buyimg.com/n7/jfs/t1/142566/30/19506/217658/5fe0af64Eebd27f0e/bada8781f8844021.png'},
  //         {link:'http://baidu.com', image:'https://img12.360buyimg.com/n7/jfs/t10657/91/404765864/233296/31b12b61/59cdc5ddNfc4f03e1.jpg'},
  //         {link:'http://baidu.com', image:'https://img10.360buyimg.com/n7/jfs/t1/139281/29/5371/119743/5f35020aE59db7535/cc0f8d5ea7dbb2a8.jpg'},
  //       ]
	export default {
    name: "HomeSwiper",
    data() {
      return {
       

      }
    },
    components: {
		  Swiper,
      SwiperItem
    },
    props: {
		  banners: {
		    type: Array,
        default: []
      }
    },
    methods: {
		  stopTimer() {
		    this.$refs.swiper.stopTimer()
      },
      startTimer() {
		    if (this.$refs.swiper) {
          this.$refs.swiper.startTimer()
        }
      }
    }
	}
</script>

<style scoped>

</style>
